package com.medical.literature.user.controller;

import com.medical.literature.common.vo.Result;
import com.medical.literature.user.dto.ContactRequest;
import com.medical.literature.user.service.ContactService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 联系支持控制器
 */
@Slf4j
@RestController
@RequestMapping("/contact")
@RequiredArgsConstructor
public class ContactController {
    
    private final ContactService contactService;

    /**
     * 提交联系支持请求
     */
    @PostMapping("/submit")
    public Result<Void> submitContact(@Valid @RequestBody ContactRequest request,
                                    @RequestHeader("X-User-Id") Long userId) {
        contactService.processContactRequest(request, userId);
        return Result.success();
    }
}